코드를 수정하기 전에 일단 관련된 코드들을 근처로 옮겨놓기. 타이딩 중 하나.
“
Reorder the code so the elements you need to change are adjacent. Cohesion order works for routines in a file: if two routines are coupled, put them next to each other.
보통은 디커플링을 하라고 하지만, Tidy first? A personal exercise in empirical software design 에서는 “당장 결합도coupling 를 낮출 수 없는 상황이라면 응집도cohesion 라고 높여둬라”고 조언.
목차 목차 관련 글 New interface, old implementation “A personal exercise in empirical software design” One pile “Inline as much of the code as you need until it's all in one big pile.” Explaining comments “You know that moment when you're reading some code and you say, "Oh, so that's what's going on!"” Guard clauses “A personal exercise in empirical software design” Extract helper “Name the routine after the purpose (not how the routine works).” 죽은 코드 “A personal exercise in empirical software design” First, After, Later, Never “A personal exercise in empirical software design 2부 중에서 발췌, 요약.” Explicit parameters “A personal exercise in empirical software design” Separate tidying “A personal exercise in empirical software design” Move declaration and initialization together “A personal exercise in empirical software design” Chunk statements “You're reading a big chunk of code and you realize, "Oh, this part does this and then that part does that."” 경험적 소프트웨어 설계 “A personal exercise in empirical software design” Explaining variables “A personal exercise in empirical software design” Explaining constants “A personal exercise in empirical software design” 설계를 언제 할까 “Besides, once the software is in production we will never have the chance to design, so let’s pile it all in to…” Ten principles for good design 관련 절: Steph Ango Normalize symmetries “Tidy one form of unnecessary variation at a time.”